# -*- coding: utf-8 -*-
require 'test/unit'
require 'm3g'

class Test_Loader < Test::Unit::TestCase
  def setup
  end

  def teadown
  end

  def test_default_variables_1
    objs = M3G::Loader::load "simple.m3g"
    assert_equal 12, objs.length

    assert_instance_of M3G::Camera            , objs[0]
    assert_instance_of M3G::Background        , objs[1]
    assert_instance_of M3G::VertexArray       , objs[2]
    assert_instance_of M3G::VertexArray       , objs[3]
    assert_instance_of M3G::VertexBuffer      , objs[4]
    assert_instance_of M3G::TriangleStripArray, objs[5]
    assert_instance_of M3G::PolygonMode       , objs[6]
    assert_instance_of M3G::Material          , objs[7]
    assert_instance_of M3G::Appearance        , objs[8]
    assert_instance_of M3G::Mesh              , objs[9]
    assert_instance_of M3G::Light             , objs[10]
    assert_instance_of M3G::World             , objs[11]
  end

  def test_default_variables_2
    data = File.read "simple.m3g"

    objs = M3G::Loader::load data, 0
    assert_equal 12, objs.length

    assert_instance_of M3G::Camera            , objs[0]
    assert_instance_of M3G::Background        , objs[1]
    assert_instance_of M3G::VertexArray       , objs[2]
    assert_instance_of M3G::VertexArray       , objs[3]
    assert_instance_of M3G::VertexBuffer      , objs[4]
    assert_instance_of M3G::TriangleStripArray, objs[5]
    assert_instance_of M3G::PolygonMode       , objs[6]
    assert_instance_of M3G::Material          , objs[7]
    assert_instance_of M3G::Appearance        , objs[8]
    assert_instance_of M3G::Mesh              , objs[9]
    assert_instance_of M3G::Light             , objs[10]
    assert_instance_of M3G::World             , objs[11]
  end

end
